package com.lidong.lowcode.core.controller.system;

import com.lidong.config.controller.BaseController;
import com.lidong.config.domain.gloabreturn.ResponseInfo;
import com.lidong.config.domain.jwt.Audience;
import com.lidong.config.domain.jwt.JwtIgnore;
import com.lidong.lowcode.core.domain.system.LoginLogDO;
import com.lidong.lowcode.core.service.system.LoginLogService;
import com.lidong.lowcode.core.service.system.SystemService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @description:
 * @author: Lidong
 * @time: 2020/7/29 21:06
 **/
@Api("这是后端系统的Controller")
@RestController
@RequestMapping("/system")
public class SystemController  extends BaseController {

    @Autowired
    private SystemService systemService;

    @Autowired
    private Audience audience;

    @Autowired
    private LoginLogService loginLogService;

    /**
     * 系统的登录接口
     * @return
     */
    @RequestMapping("/login")
    @JwtIgnore
    public ResponseInfo<Map<String,Object>> login(){
        Map<String, String> paramMap = this.getParamMap(request);
        return systemService.login(request,paramMap);
    }

    /**
     * 获取登录日志信息
     * @param id
     */
    @GetMapping("/loginlog/get/{id}")
    public ResponseInfo<LoginLogDO> getLoginLogById(@PathVariable("id") String id){
        return loginLogService.getLoginLogById(id);
    }




}
